### Project 2 PWM Regulating Light Brightness **1.Introduction** In this project, we should connect signal port of LED module to PWM port, and use graphical programming to control it to produce various PWM signals. So the brightness of LED changes, with effect of breathing LED. **2.Materials Required** 1. KEYESTUDIO UNO Control Board *1 2. V5 Sensor Shield*1 3. Piranha LED*1 4. Female to Female Dupont Line*3 **3.Connection Diagram** ![](media/image-20251201155125492.png) ![](media/image-20251201155155458.png) **4.Sample Code** ```c int _ABVAR_1_brightness = 0 ; void setup() { pinMode( 10 , OUTPUT); } void loop() { while ( ( ( _ABVAR_1_brightness ) < ( 255 ) ) ) { _ABVAR_1_brightness = ( _ABVAR_1_brightness + 1 ) ; analogWrite(10 , _ABVAR_1_brightness); delay( 5 ); } while ( ( ( _ABVAR_1_brightness ) > ( 0 ) ) ) { _ABVAR_1_brightness = ( _ABVAR_1_brightness - 1 ) ; analogWrite(10 , _ABVAR_1_brightness); delay( 5 ); } delay( 500 ); } ``` **5.Result** That’s how we use graphical programming to gradually light the LED up and dim it. Just like the LED is taking a breath. That’s why we vividly call it breathing LED.